package com.example.cwproject.mapper;

import com.example.cwproject.entity.Picture;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface PictureMapper {

    @Delete("delete from `picture` where `picture`.postID = #{postID}")
    void delete(Integer postID);

    @Select("select * from picture where postID = #{postID}")
    Picture select(Integer postID);

    @Insert("insert into `picture` (postID, picture_road) values (#{postID}, #{pictureUrl})")
    void insert(Integer postID, String pictureUrl);

    @Select("select picture_road from `picture` where postID = #{postID} ")
    String selectUrl(Integer postID);

    @Update("update picture set picture_road = #{url} where postID = #{postID}")
    void updateUrl(String url, Integer postID);

}
